home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / bbs / termv4.6 / extras / source / gtlayout-source.lha / LTP_HexEditRoutine.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-18  |  1.6 KB  |  84 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. #ifdef DO_HEXHOOK
  15. ULONG __saveds __asm
  16. LTP_HexEditRoutine(REG(a0) struct Hook *hook,REG(a2) struct SGWork *sgw,REG(a1) ULONG *msg)
  17. {
  18.     ULONG result = FALSE;
  19.  
  20.     if(*msg == SGH_KEY)
  21.     {
  22.         LayoutHandle *handle;
  23.         ObjectNode *node;
  24.         BOOL activate;
  25.  
  26.         handle = hook->h_Data;
  27.         activate = TRUE;
  28.  
  29.         if(sgw->IEvent->ie_Code == 0x5F && handle->HelpHook)
  30.         {
  31.             sgw->Code        = 0x5F;
  32.             sgw->Actions    = (sgw->Actions & ~SGA_BEEP) | SGA_END | SGA_USE;
  33.  
  34.             LTP_AddHistory(sgw);
  35.  
  36.             return(TRUE);
  37.         }
  38.  
  39.         if(sgw->IEvent->ie_Code == CURSORUP || sgw->IEvent->ie_Code == CURSORDOWN)
  40.             LTP_HandleHistory(sgw);
  41.  
  42.         if(GETOBJECT(sgw->Gadget,node))
  43.         {
  44.             if(node->Type == INTEGER_KIND)
  45.             {
  46.                 if(node->Special.Integer.LastGadget)
  47.                     activate = FALSE;
  48.  
  49.                 result = TRUE;
  50.  
  51.                 if(!LTP_ConvertNum((node->Min < 0),sgw->WorkBuffer,(LONG *)&sgw->StringInfo->LongInt))
  52.                 {
  53.                     sgw->EditOp        = EO_BADFORMAT;
  54.                     sgw->Actions    = SGA_BEEP;
  55.                 }
  56.  
  57.                 if(node->Special.Integer.ValidateHook)
  58.                 {
  59.                     if(!CallHookPkt(node->Special.Integer.ValidateHook,sgw,msg))
  60.                     {
  61.                         sgw->EditOp        = EO_BADFORMAT;
  62.                         sgw->Actions    = SGA_BEEP;
  63.                     }
  64.                 }
  65.             }
  66.         }
  67.  
  68.         if(sgw->EditOp == EO_ENTER && !(sgw->IEvent->ie_Qualifier & QUALIFIER_SHIFT))
  69.         {
  70.             if(activate && handle->AutoActivate)
  71.                 sgw->Actions |= SGA_NEXTACTIVE;
  72.  
  73.             if(!(sgw->Actions & SGA_NEXTACTIVE))
  74.                 sgw->Code = '\r';
  75.         }
  76.  
  77.         if(sgw->Actions & SGA_END)
  78.             LTP_AddHistory(sgw);
  79.     }
  80.  
  81.     return(result);
  82. }
  83. #endif
  84.